home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ffffttttwwww((((3333CCCC)))) ffffttttwwww((((3333CCCC))))
-
-
-
- NNNNAAAAMMMMEEEE
- _ffff_tttt_wwww, _ffff_tttt_wwww_6666_4444, _nnnn_ffff_tttt_wwww _nnnn_ffff_tttt_wwww_6666_4444 - walk a file tree
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ffff_tttt_wwww_...._hhhh_>>>>
-
- _iiii_nnnn_tttt _ffff_tttt_wwww _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_pppp_aaaa_tttt_hhhh_,,,, _iiii_nnnn_tttt _((((_****_ffff_nnnn_)))) _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_,,,, _cccc_oooo_nnnn_ssss_tttt _ssss_tttt_rrrr_uuuu_cccc_tttt
- _ssss_tttt_aaaa_tttt _****_,,,, _iiii_nnnn_tttt_))))_,,,, _iiii_nnnn_tttt _dddd_eeee_pppp_tttt_hhhh_))))_;;;;
-
- _iiii_nnnn_tttt _ffff_tttt_wwww_6666_4444 _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_pppp_aaaa_tttt_hhhh_,,,, _iiii_nnnn_tttt _((((_****_ffff_nnnn_)))) _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_,,,, _cccc_oooo_nnnn_ssss_tttt _ssss_tttt_rrrr_uuuu_cccc_tttt
- _ssss_tttt_aaaa_tttt_6666_4444 _****_,,,, _iiii_nnnn_tttt_))))_,,,, _iiii_nnnn_tttt _dddd_eeee_pppp_tttt_hhhh_))))_;;;;
-
- _iiii_nnnn_tttt _nnnn_ffff_tttt_wwww _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_pppp_aaaa_tttt_hhhh_,,,, _iiii_nnnn_tttt _((((_****_ffff_nnnn_)))) _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_,,,, _cccc_oooo_nnnn_ssss_tttt _ssss_tttt_rrrr_uuuu_cccc_tttt
- _ssss_tttt_aaaa_tttt _****_,,,, _iiii_nnnn_tttt_,,,, _ssss_tttt_rrrr_uuuu_cccc_tttt _FFFF_TTTT_WWWW_****_))))_,,,, _iiii_nnnn_tttt _dddd_eeee_pppp_tttt_hhhh_,,,, _iiii_nnnn_tttt _ffff_llll_aaaa_gggg_ssss_))))_;;;;
-
- _iiii_nnnn_tttt _nnnn_ffff_tttt_wwww_6666_4444 _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_pppp_aaaa_tttt_hhhh_,,,, _iiii_nnnn_tttt _((((_****_ffff_nnnn_)))) _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_,,,, _cccc_oooo_nnnn_ssss_tttt _ssss_tttt_rrrr_uuuu_cccc_tttt
- _ssss_tttt_aaaa_tttt_6666_4444 _****_,,,, _iiii_nnnn_tttt_,,,, _ssss_tttt_rrrr_uuuu_cccc_tttt _FFFF_TTTT_WWWW_****_))))_,,,, _iiii_nnnn_tttt _dddd_eeee_pppp_tttt_hhhh_,,,, _iiii_nnnn_tttt _ffff_llll_aaaa_gggg_ssss_))))_;;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _ffff_tttt_wwww recursively descends the directory hierarchy rooted in _p_a_t_h. For
- each object in the hierarchy, _ffff_tttt_wwww calls the user-defined function _f_n,
- passing it a pointer to a null-terminated character string containing the
- name of the object, a pointer to a _ssss_tttt_aaaa_tttt structure (see _ssss_tttt_aaaa_tttt(2))
- containing information about the object, and an integer. Possible values
- of the integer, defined in the _ffff_tttt_wwww_...._hhhh header file, are:
-
- _FFFF_TTTT_WWWW______FFFF The object is a file.
-
- _FFFF_TTTT_WWWW______DDDD The object is a directory.
-
- _FFFF_TTTT_WWWW______DDDD_NNNN_RRRR The object is a directory that cannot be read. Descendants
- of the directory will not be processed.
-
- _FFFF_TTTT_WWWW______NNNN_SSSS _ssss_tttt_aaaa_tttt failed on the object because of lack of appropriate
- permission or the object is a symbolic link that points to a
- non-existent file. The stat buffer passed to _f_n is undefined.
-
- _ffff_tttt_wwww visits a directory before visiting any of its descendants.
-
- The tree traversal continues until the tree is exhausted, an invocation
- of _f_n returns a nonzero value, or some error is detected within _ffff_tttt_wwww (such
- as an I/O error). If the tree is exhausted, _ffff_tttt_wwww returns zero. If _f_n
- returns a nonzero value, _ffff_tttt_wwww stops its tree traversal and returns
- whatever value was returned by _f_n. If _ffff_tttt_wwww detects an error other than
- _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS, it returns -1, and sets the error type in _eeee_rrrr_rrrr_nnnn_oooo.
-
- The function _ffff_tttt_wwww_6666_4444 is identical to _ffff_tttt_wwww except that it passes a pointer to
- a _ssss_tttt_aaaa_tttt_6666_4444 structure (see _ssss_tttt_aaaa_tttt_6666_4444(2)) to the user supplied function _f_n.
-
- The function _nnnn_ffff_tttt_wwww is similar to _ffff_tttt_wwww except that it takes an additional
- argument, _f_l_a_g_s. The _f_l_a_g_s field is used to specify:
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- ffffttttwwww((((3333CCCC)))) ffffttttwwww((((3333CCCC))))
-
-
-
- _FFFF_TTTT_WWWW______PPPP_HHHH_YYYY_SSSS Physical walk, does not follow symbolic links. Otherwise,
- _nnnn_ffff_tttt_wwww will follow links but will not walk down any path that
- crosses itself.
-
- _FFFF_TTTT_WWWW______MMMM_OOOO_UUUU_NNNN_TTTT The walk will not cross a mount point.
-
- _FFFF_TTTT_WWWW______DDDD_EEEE_PPPP_TTTT_HHHH All subdirectories will be visited before the directory
- itself.
-
- _FFFF_TTTT_WWWW______CCCC_HHHH_DDDD_IIII_RRRR The walk will change to each directory before reading it.
-
- The function _nnnn_ffff_tttt_wwww calls _f_n with four arguments at each file and
- directory. The first argument is the pathname of the object, the second
- is a pointer to the _ssss_tttt_aaaa_tttt buffer, the third is an integer giving
- additional information, and the fourth is a _ssss_tttt_rrrr_uuuu_cccc_tttt _FFFF_TTTT_WWWW that contains the
- following members:
- _iiii_nnnn_tttt _bbbb_aaaa_ssss_eeee_;;;;
- _iiii_nnnn_tttt _llll_eeee_vvvv_eeee_llll_;;;;
- _bbbb_aaaa_ssss_eeee is the offset into the pathname of the base name of the object.
- _llll_eeee_vvvv_eeee_llll indicates the depth relative to the rest of the walk, where the
- root level is zero.
-
- The values of the third argument are as follows:
-
- _FFFF_TTTT_WWWW______FFFF The object is a file.
-
- _FFFF_TTTT_WWWW______DDDD The object is a directory.
-
- _FFFF_TTTT_WWWW______DDDD_PPPP The object is a directory and subdirectories have been
- visited.
-
- _FFFF_TTTT_WWWW______SSSS_LLLL_NNNN The object is a symbolic link that points to a non-existent
- file.
-
- _FFFF_TTTT_WWWW______DDDD_NNNN_RRRR The object is a directory that cannot be read. _f_n will not
- be called for any of its descendants.
-
- _FFFF_TTTT_WWWW______NNNN_SSSS _ssss_tttt_aaaa_tttt failed on the object because of lack of appropriate
- permission. The stat buffer passed to _f_n is undefined. _ssss_tttt_aaaa_tttt
- failure other than lack of appropriate permission (_EEEE_AAAA_CCCC_CCCC_EEEE_SSSS) is
- considered an error and _nnnn_ffff_tttt_wwww will return -1.
-
- The function _nnnn_ffff_tttt_wwww_6666_4444 is identical to _nnnn_ffff_tttt_wwww except that it passes a pointer
- to a _ssss_tttt_aaaa_tttt_6666_4444 structure (see _ssss_tttt_aaaa_tttt_6666_4444(2)) to the user supplied function _f_n.
-
- Both _ffff_tttt_wwww and _nnnn_ffff_tttt_wwww use one file descriptor for each level in the tree.
- The _d_e_p_t_h argument limits the number of file descriptors so used. If
- _d_e_p_t_h is zero or negative, the effect is the same as if it were 1. _d_e_p_t_h
- must not be greater than the number of file descriptors currently
- available for use. _ffff_tttt_wwww will run faster if _d_e_p_t_h is at least as large as
- the number of levels in the tree. When _ffff_tttt_wwww and _nnnn_ffff_tttt_wwww return, they close
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- ffffttttwwww((((3333CCCC)))) ffffttttwwww((((3333CCCC))))
-
-
-
- any file descriptors they have opened; they do not close any file
- descriptors that may have been opened by _f_n.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- _ssss_tttt_aaaa_tttt(2), _mmmm_aaaa_llll_llll_oooo_cccc(3C).
-
- NNNNOOOOTTTTEEEESSSS
- Because _ffff_tttt_wwww is recursive, it is possible for it to terminate with a
- memory fault when applied to very deep file structures.
-
- _ffff_tttt_wwww uses _mmmm_aaaa_llll_llll_oooo_cccc(3C) to allocate dynamic storage during its operation. If
- _ffff_tttt_wwww is forcibly terminated, such as by _llll_oooo_nnnn_gggg_jjjj_mmmm_pppp being executed by _f_n or an
- interrupt routine, _ffff_tttt_wwww will not have a chance to free that storage, so it
- will remain permanently allocated. A safe way to handle interrupts is to
- store the fact that an interrupt has occurred, and arrange to have _f_n
- return a nonzero value at its next invocation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-